package cmo.neutech.day15;
public class producer {

   public synchronized void produce(){
       while(Text.count == Text.buff.length){
           try {
               wait();
           } catch (InterruptedException e) {
               Thread.currentThread().interrupt();
               System.out.println("生产者中断");
           }
       }
       Text.buff[Text.count++] = (int) (Math.random() * 10);
       System.out.println("生产者生产了一个产品，当前数量："+ Text.count);
       notify();
   }
}
